﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace PacketRush.Core
{
    /// <summary>
    /// Holds information about a client along with the connection
    /// </summary>
    internal class ClientInfo
    {
        /// <summary>
        /// The ticks at which this connection was last pinged
        /// </summary>
        public long LastPingedAt { get; set; }

        /// <summary>
        /// The number of ping packets that have been sent without acknowledgement
        /// </summary>
        public int NumUnreceivedPingAcks { get; set; }

        /// <summary>
        /// The connection for this client
        /// </summary>
        public INetConnection Connection { get; set; }

        private uint _PacketSequenceIndexCounter = 1;

        /// <summary>
        /// Gets the next sequence index, must be used to assign an id to a packet that is
        /// just about to be sent.
        /// </summary>
        /// <returns>The next packet sequence index.</returns>
        public uint CreateNextPacketSequenceIndex()
        {
            return _PacketSequenceIndexCounter++;
        }
    }
}
